// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'dart:ui';

import 'package:flutter/material.dart';

import 'package:junyeyishu/utils/utils.dart';
import 'package:junyeyishu/widgets/QGWidget.dart';
import 'package:junyeyishu/widgets/QGListState.dart';
import 'package:junyeyishu/widgets/QGNavigationBar.dart';

import 'widgets/QGSynthesisCell.dart';

class QGSynthesisList extends StatefulWidget {
  const QGSynthesisList({super.key});
  @override
  State<QGSynthesisList> createState() => _QGSynthesisListState();
}

class _QGSynthesisListState extends QGListState<QGSynthesisList> {
  @override
  void initState() {
    super.initState();

    listURL = url_index_combineEventList;
    listKey = "list";

    onRefresh();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Stack(
          children: [
            QGImage(asset: "synthesis_bg", width: kScreenWidth),
            Column(children: [
              SizedBox(height: 103.rpx),
              buildList(),
            ]),
            buildTop(),
          ],
        ));
  }

  buildTop() {
    return Container(
      child: QGNavigationBar(
          title: "",
          titleStyle: TextStyle(
            color: Color(0xFFFFFFFF),
            fontSize: 16.rpx,
            fontWeight: FontWeight.bold,
          )),
    );
  }

  @override
  itemBuilder(context, index, data) {
    return GestureDetector(
        onTap: () {
          if (!User.isLogin) {
            Navigator.of(context).pushNamed(PageLogin);
            return;
          }

          Navigator.of(context).pushNamed(PageSynthesis, arguments: data["id"]);
        },
        child: QGSynthesisCell(data: data));
  }
  
}
